From bf25235281329df309f8b9221cdf1dbc9836d2d2 Mon Sep 17 00:00:00 2001 From: "mjw@wray-m-3.hpl.hp.com" Date: Thu, 19 Aug 2004 11:58:48 +0000 Subject: [PATCH] bitkeeper revision 1.1159.1.87 (412495f853g9qdFCK3fe-wp3blfTlA) Trap error in cpu value from config. --- tools/python/xen/xend/XendDomainInfo.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/tools/python/xen/xend/XendDomainInfo.py b/tools/python/xen/xend/XendDomainInfo.py index 63dc7f49ab..f8345f58b4 100644 --- a/tools/python/xen/xend/XendDomainInfo.py +++ b/tools/python/xen/xend/XendDomainInfo.py @@ -703,10 +703,14 @@ class XendDomainInfo: return memory = self.memory name = self.name - cpu = int(sxp.child_value(self.config, 'cpu', '-1')) + try: + cpu = int(sxp.child_value(self.config, 'cpu', '-1')) + except: + raise VmError('invalid cpu') cpu_weight = self.cpu_weight dom = self.dom or 0 - dom = xc.domain_create(dom= dom, mem_kb= memory * 1024, name= name, cpu= cpu, cpu_weight= cpu_weight) + dom = xc.domain_create(dom= dom, mem_kb= memory * 1024, + name= name, cpu= cpu, cpu_weight= cpu_weight) if dom <= 0: raise VmError('Creating domain failed: name=%s memory=%d' % (name, memory)) -- 2.30.2